package com;

import java.io.*;

public class Test10 {
    public static void main(String[] args) throws IOException {
        String srcPath = "C:\\Users\\阳光正直夏明伟15805655221\\Desktop\\Test\\测试.txt";
        String desPath = "HomeWork15\\dir\\目标文件5.txt";
        String srcCode = "gbk";
        String desCode = "utf-8";

        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(srcPath), srcCode));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(desPath), desCode));

        String line;
        while ((line = br.readLine()) != null) {
            bw.write(line);
            bw.newLine();
            bw.flush();
        }
        bw.close();
        br.close();
    }
}
